// Copyright 2008 and onwards Matt Burkhart, Mike Chan.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.

#ifndef PATH_UTILS_H__
#define PATH_UTILS_H__

#include <string>

// Utility functions for the handling of file paths.

// Basename is the file name at the end of the path.
// Example: Basename("/foo/bar") == "bar"
std::string Basename(const std::string& path);

// StripBasename returns the path without the file name at the end.
// Example: StripBasename("/foo/bar") == "/foo"
// Example: StripBasename("/foo") == ""
// Example: StripBasename("foo") == ""
std::string StripBasename(const std::string& path);

// Join takes two paths and returns a single concatenated path
// appropriately.
// Example: Join("foo", "bar") == "foo/bar"
// Example: Join("foo/", "/bar") == "foo/bar"
// Example: Join("foo", "") == "foo"
std::string Join(const std::string& path1,
		 const std::string& path2);

#endif // PATH_UTILS_H__
